import java.util.*;

// @lc code=start
class Solution {
    public List<List<Integer>> subsets(int[] nums) {
        List<Integer> tmp = new ArrayList();
        List<List<Integer>> res = new ArrayList();
        int len = nums.length;
        int num = 1<<len;
        for(int i=0;i<num;i++){
            tmp.clear();
            for(int j=0;j<len;j++){
                if((i&(1<<j)) != 0) tmp.add(nums[j]);
            }
            res.add(new ArrayList<>(tmp));
        }
        return res;
    }

    public static void main(String[] args){
        Solution solution = new Solution();
        System.out.println(solution.subsets(new int[]{1,2,3}));
    }

}
// @lc code=end
